import mongoose from "mongoose";
import userSchema from "./userModel";
import bookSchema from "./bookModel";
import categorySchema from "./categoryModel";

var uri = "mongodb://unicorn:unicorn@ac-vldnvij-shard-00-00.kwqi9a2.mongodb.net:27017,ac-vldnvij-shard-00-01.kwqi9a2.mongodb.net:27017,ac-vldnvij-shard-00-02.kwqi9a2.mongodb.net:27017/?ssl=true&replicaSet=atlas-jfy6r0-shard-0&authSource=admin&retryWrites=true&w=majority&appName=Cluster0";

async function main() {
    mongoose.connect(uri);
}

main().then(() => {
    console.log('Mongoose Connected');
}).catch((err) => {
    console.log(err);
});

const User = mongoose.model('User', userSchema);
const Book = mongoose.model('Book', bookSchema);
const Category = mongoose.model('Category', categorySchema);
export { User, Book, Category };